package ch.fusun.baron.city;

import ch.fusun.baron.city.api.CityService;
import ch.fusun.baron.core.injection.Inject;
import ch.fusun.baron.data.DataUpdate;
import ch.fusun.baron.map.Tile;

/**
 * Sets the city on the tile
 */
public class NewCityDataUpdate implements DataUpdate {

	private Tile tile;
	private City city;

	@Inject
	private transient CityService cityService;

	/**
	 * Kryo
	 */
	public NewCityDataUpdate() {
	}

	/**
	 * @param tile
	 *            The tile
	 * @param city
	 *            The city
	 */
	public NewCityDataUpdate(Tile tile, City city) {
		this.tile = tile;
		this.city = city;
	}

	@Override
	public void update() {
		cityService.setCity(this.tile, this.city);
	}

}
